<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/Nexbie.png" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
    <title>Nexbie</title>
    <!-- Google Tag Manager -->
    <script>
      (function (w, d, s, l, i) {
        w[l] = w[l] || [];
        w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
        var f = d.getElementsByTagName(s)[0],
          j = d.createElement(s),
          dl = l != 'dataLayer' ? '&l=' + l : '';
        j.async = true;
        j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
        f.parentNode.insertBefore(j, f);
      })(window, document, 'script', 'dataLayer', 'GTM-N9HZT9BM');
    </script>
    <!-- End Google Tag Manager -->

    <!-- Google tag (gtag.js) -->
    <script defer src="https://www.googletagmanager.com/gtag/js?id=%VITE_GTM_ID%"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag() {
        dataLayer.push(arguments);
      }
      gtag('js', new Date());
      gtag('config', '%VITE_GTM_ID%');
    </script>
    <!-- End Google Tag Manager -->

      <script>
          // 设计稿宽度（与 postcss-pxtorem 的 rootValue 对应）
          const designWidth = 393;
          const rootValue = 39.3
          // 计算根字体大小：屏幕宽度 / 设计稿宽度 * rootValue（此处 rootValue 为 39.3）
          function setRemUnit() {
              const screenWidth = document.documentElement.clientWidth || window.innerWidth;
              // 限制最大宽度（如超过 750px 按 750px 计算，避免平板上过大）
              const maxWidth = 750;
              const actualWidth = Math.min(screenWidth, maxWidth);
              const rem = (actualWidth / designWidth) * rootValue;
              document.documentElement.style.fontSize = rem + 'px';
          }
          setRemUnit();
          window.addEventListener('resize', setRemUnit); // 监听窗口变化
      </script>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
    <!-- 谷歌登录 -->
    <script src="https://accounts.google.com/gsi/client" async defer></script>

    <!-- Google Tag Manager (noscript) -->
    <noscript>
      <iframe
        src="https://www.googletagmanager.com/ns.html?id=GTM-N9HZT9BM"
        height="0"
        width="0"
        style="display: none; visibility: hidden"></iframe>
    </noscript>
    <!-- End Google Tag Manager (noscript) -->
  </body>
</html>
